public async Task <bool> Delete <T>(T entity) where T : class { if (typeof(T) == typeof(User)) { return(await _userDataContext.Delete((entity as User).Id)); } else if (typeof(T) == typeof(Like)) { return(await _likesDataContext.Delete((entity as Like).LikerId, (entity as Like).LikeeId)); } else if (typeof(T) == typeof(Photo)) { return(await _photosDataContext.Delete((entity as Photo).Id)); } else if (typeof(T) == typeof(Message)) { return(await _messagesDataContext.Delete((entity as Message).Id)); } else { throw new NotImplementedException(); } }