public boolean updateAppKey(@NonNull final ApplicationKey applicationKey) throws IllegalArgumentException {
        final int keyIndex = applicationKey.getKeyIndex();
        final ApplicationKey key = getAppKey(keyIndex);
        //If the keys are not the same we check if its in use before updating the key
        if (!isKeyInUse(key)) {
            //We check if the contents of the key are the same
            //This will return true only if the key index and the key are the same
            return updateMeshKey(applicationKey);
        } else {
            throw new IllegalArgumentException("Unable to update a application key that's already in use.");
        }
    }
Updates an app key in the mesh network.

<p>
Updates the Key if it is not use, if not Updating a Key's key value requires initiating a Key Refresh Procedure. This requires
the bound NetworkKey of the AppKey to be updated. A NetworkKey that's in use would require aKey Refresh Procedure to update
it's key contents. However a NetworkKey that's not in could be updated without this procedure. If the key is in use, call
{@link #distributeNetKey(NetworkKey, byte[])} to initiate the Key Refresh Procedure. After distributing the NetworkKey bound to
the Application Key, user may call {@link #distributeAppKey(ApplicationKey, byte[])} to update the corresponding ApplicationKey.
</p>

@param applicationKey {@link ApplicationKey}
@throws IllegalArgumentException if the key is already in use
mesh/src/main/java/no/nordicsemi/android/mesh/BaseMeshNetwork.java