updateProfile = (dispatch, firebase, profileUpdate, options) => {
  const {
    _: { config }
  } = firebase
  dispatch({
    type: actionTypes.PROFILE_UPDATE_START,
    payload: profileUpdate
  })
  // Select update promise type (firebase/firestore) based on config
  const updatePromise = config.useFirestoreForProfile
    ? updateProfileOnFirestore
    : updateProfileOnRTDB
  return updatePromise(firebase, profileUpdate, options)
    .then((snap) => {
      dispatch({
        type: actionTypes.PROFILE_UPDATE_SUCCESS,
        payload: config.useFirestoreForProfile ? snap.data() : snap.val()
      })
      return snap
    })
    .catch((error) => {
      dispatch({ type: actionTypes.PROFILE_UPDATE_ERROR, error })
      return Promise.reject(error)
    })
}
Update user profile
@param {Function} dispatch - Action dispatch function
@param {object} firebase - Internal firebase object
@param {object} profileUpdate - Update for profile
@param {object} options - Options object
@returns {Promise} Resolves after updating profile
@private