private static async Task <bool> UpdatePostCommentDraftInternal(
            PostCommentDraft draftTarget,
            string commentText = null, bool?isAnonymous = null)
        {
            if (draftTarget == null)
            {
                return(false);
            }

            if (commentText != null)
            {
                draftTarget.CommentText = commentText;
            }
            if (isAnonymous != null)
            {
                draftTarget.IsAnonymous = isAnonymous.Value;
            }

            Context.Update(draftTarget);

            await Context.SaveChangesAsync()
            .ConfigureAwait(false);

            return(true);
        }
        private static async Task <bool> RemovePostCommentDraftInternal(int userId, int postId)
        {
            try
            {
                if (userId < 0 || postId < 0)
                {
                    return(false);
                }

                var draftTarget = new PostCommentDraft
                {
                    UserId = (uint)userId,
                    PostId = (uint)postId
                };

                return(await RemovePostCommentDraftInternal(draftTarget)
                       .ConfigureAwait(false));
            }
            catch (Exception ex)
            {
                LogManager.Default.Error(ex, "Storage error");

                return(false);
            }
        }
        private static async Task <bool> UpdatePostCommentDraftInternal(PostCommentDraft draftTarget,
                                                                        string commentText = null, bool?isAnonymous = null)
        {
            try
            {
                if (draftTarget == null)
                {
                    return(false);
                }

                if (commentText != null)
                {
                    draftTarget.CommentText = commentText;
                }
                if (isAnonymous != null)
                {
                    draftTarget.IsAnonymous = isAnonymous.Value;
                }

                Context.Update(draftTarget);

                await Context.SaveChangesAsync()
                .ConfigureAwait(false);

                return(true);
            }
            catch (Exception ex)
            {
                LogManager.Default.Error(ex, "Storage error");

                return(false);
            }
        }
        private static async Task <bool> AddPostCommentDraftInternal(int userId, int postId,
                                                                     string commentText, bool isAnonymous)
        {
            try
            {
                if (userId < 0 || postId < 0)
                {
                    return(false);
                }

                var draftTarget = new PostCommentDraft
                {
                    UserId      = (uint)userId,
                    PostId      = (uint)postId,
                    CommentText = commentText,
                    IsAnonymous = isAnonymous
                };

                return(await AddPostCommentDraftInternal(draftTarget)
                       .ConfigureAwait(false));
            }
            catch (Exception ex)
            {
                LogManager.Default.Error(ex, "Storage error");

                return(false);
            }
        }
        private static async Task <bool> RemovePostCommentDraftInternal(
            PostCommentDraft draftTarget)
        {
            if (draftTarget == null)
            {
                return(false);
            }

            Context.Remove(draftTarget);

            await Context.SaveChangesAsync()
            .ConfigureAwait(false);

            return(true);
        }
        private static async Task <bool> RemovePostCommentDraftInternal(
            int userId, int postId)
        {
            if (userId < 0 || postId < 0)
            {
                return(false);
            }

            var draftTarget = new PostCommentDraft
            {
                UserId = (uint)userId,
                PostId = (uint)postId
            };

            return(await RemovePostCommentDraftInternal(draftTarget)
                   .ConfigureAwait(false));
        }
        private static async Task <bool> AddPostCommentDraftInternal(
            int userId, int postId,
            string commentText, bool isAnonymous)
        {
            if (userId < 0 || postId < 0)
            {
                return(false);
            }

            var draftTarget = new PostCommentDraft
            {
                UserId      = (uint)userId,
                PostId      = (uint)postId,
                CommentText = commentText,
                IsAnonymous = isAnonymous
            };

            return(await AddPostCommentDraftInternal(draftTarget)
                   .ConfigureAwait(false));
        }
        private static async Task <bool> RemovePostCommentDraftInternal(PostCommentDraft draftTarget)
        {
            try
            {
                if (draftTarget == null)
                {
                    return(false);
                }

                Context.Remove(draftTarget);

                await Context.SaveChangesAsync()
                .ConfigureAwait(false);

                return(true);
            }
            catch (Exception ex)
            {
                LogManager.Default.Error(ex, "Storage error");

                return(false);
            }
        }