private static async Task <IActionResult> ProcessPost(FirebaseClient client, string firebaseId, object data)
        {
            (IActionResult result, ResearchPostingObject posting) = ResearchPostingObject.Create(client, firebaseId, data).Result;
            if (result is BadRequestObjectResult)
            {
                return(result);
            }

            await client.Child("posting").Child(posting.NameAuthor).PutAsync(posting);

            return(result);
        }
        public async static Task <(IActionResult, ResearchPostingObject)> Create(FirebaseClient client, string firebaseId, dynamic data)
        {
            string author = data?.author;

            if (string.IsNullOrEmpty(author))
            {
                return(new BadRequestObjectResult(new { message = "invalid author" }), null);
            }
            string organization = data?.organization;

            if (string.IsNullOrEmpty(organization))
            {
                return(new BadRequestObjectResult(new { message = "invalid organization" }), null);
            }

            int participantCount = 0;


            string projectDescription = data?.projectDescription;

            if (string.IsNullOrEmpty(projectDescription))
            {
                return(new BadRequestObjectResult(new { message = "invalid project description" }), null);
            }


            string projectName = data?.projectName;

            if (string.IsNullOrEmpty(projectName))
            {
                return(new BadRequestObjectResult(new { message = "invalid project name" }), null);
            }



            var posting = new ResearchPostingObject(author,
                                                    organization,
                                                    participantCount,
                                                    projectDescription,
                                                    projectName,
                                                    firebaseId);

            var existing = await client.Child("posting").Child(posting.NameAuthor).OnceSingleAsync <ResearchPostingObject>();

            if (existing != null)
            {
                return(new BadRequestObjectResult(new { message = "Posting for this author and project name already exists." }), null);
            }

            return((ActionResult) new OkObjectResult(posting), posting);
        }