applyChangesLocal :: FilePath -> Map Path RemoteFile -> [Change] -> ApiAction [Change]
applyChangesLocal syncDir remoteFiles = fmap catMaybes . mapM applyChange
    where
        applyChange :: Change -> ApiAction (Maybe Change)
        applyChange (Created file) = tryWithLogging $ applyCreatedToLocal syncDir remoteFiles file
        applyChange (Deleted file) = tryWithLogging $ applyDeletedToLocal syncDir file
applyChangesLocal :: FilePath -> Map Path RemoteFile -> [Change] -> ApiAction [Change]
applyChangesLocal syncDir remoteFiles = fmap catMaybes . mapM applyChange
    where
        applyChange :: Change -> ApiAction (Maybe Change)
        applyChange (Created file) = tryWithLogging $ applyCreatedToLocal syncDir remoteFiles file
        applyChange (Deleted file) = tryWithLogging $ applyDeletedToLocal syncDir file
applyChangesLocal syncDir remoteFiles = fmap catMaybes . mapM applyChange
    where
        applyChange :: Change -> ApiAction (Maybe Change)
        applyChange (Created file) = tryWithLogging $ applyCreatedToLocal syncDir remoteFiles file
        applyChange (Deleted file) = tryWithLogging $ applyDeletedToLocal syncDir file