public async Task <ResultTypes> UpdateNameAsync(string firstName, string secondName)
        {
            AccountUpdatesEntity accountUpdatesDal =
                await _accountRepository.GetAccountUpdatesAsync(_userInfo.AccountId);

            if (accountUpdatesDal != null)
            {
                AccountUpdates accountUpdates = _mapper.Map <AccountUpdates>(accountUpdatesDal);

                DateTimeOffset whenCanUpdateName =
                    accountUpdates.LastNameUpdateTime + _accountUpdatingSettings.NameUpdatingInterval;

                if (whenCanUpdateName > DateTimeOffset.Now)
                {
                    return(ResultTypes.InvalidData);
                }
            }

            await _accountRepository.UpdateNameAsync(_userInfo.AccountId, firstName, secondName);

            return(ResultTypes.Ok);
        }
        public async Task <AddResult> UpdateAvatarAsync(byte[] avatarByteArray, string fileExtension)
        {
            AccountUpdatesEntity accountUpdatesDal =
                await _accountRepository.GetAccountUpdatesAsync(_userInfo.AccountId);

            if (accountUpdatesDal != null)
            {
                AccountUpdates accountUpdates = _mapper.Map <AccountUpdates>(accountUpdatesDal);

                DateTimeOffset whenCanUpdateAvatar =
                    accountUpdates.LastAvatarUpdateTime + _accountUpdatingSettings.AvatarUpdatingInterval;

                if (whenCanUpdateAvatar > DateTimeOffset.Now)
                {
                    return(new AddResult(ResultTypes.InvalidData, null));
                }
            }

            await _accountRepository.UpdateAvatarAsync(_userInfo.AccountId, avatarByteArray, fileExtension);

            // account id as created item id because image has the same name as member id
            return(new AddResult(ResultTypes.Ok, _userInfo.AccountId));
        }